package ferp.android.dialogs;

import android.content.Context;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.TextView;
import ferp.android.GUI;
import ferp.android.R;

/**
 * User: igorgok
 * Date: 5/29/12 1:30 PM
 */
public class Dialog extends android.app.Dialog
{
  public Dialog(Context context, int resLayout)
  {
    this(context, resLayout, View.NO_ID);
  }

  public Dialog(Context context, int resLayout, int resTitleText)
  {
    super(context, R.style.Dialog);

    // hide original title
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    // set content views
    setContentView(resLayout);

    // resolve title
    title = (TextView)findViewById(R.id.dlg_element_title_text);

    if (title != null)
    {
      title.setTypeface(GUI.Font.BOLD);

      if (resTitleText != View.NO_ID)
        title.setText(resTitleText);
    }
  }

  protected Button resolveButton(int id)
  {
    Button b = (Button)findViewById(id);

    b.setTypeface(GUI.Font.BOLD);

    return b;
  }

  protected Button resolveButton(int id, int resText)
  {
    Button b = resolveButton(id);

    b.setText(resText);

    return b;
  }

  protected TextView title;
}
